import { originSources } from "./registrys/originSources";
// 定义源函数类型
export type SourceFunction = () => Promise<ProcessedItem[]>;
export type SourceObject = Record<string, SourceFunction>;

export type SourceImport = () => Promise<{ default: SourceObject }>;


// 定义源键类型
export type SourceKey = keyof typeof originSources;;


export interface ProcessedItem {
    id: string;
    title: string;
    url: string;
    date?: string | number;
    extra?: {
        hot?: string;
        content?: string;
    }
}

// 基础来源类型
type SourceInfo<T extends string = string> = {
    name: string;
    desc: string;
    home: string;
    // 可以添加其他通用属性
    type?: T; // 泛型参数，可用于区分来源类型
};

// 来源映射类型
export type OriginSources<T extends string = string> = Record<string, SourceInfo<T>>;